package com.xbts.screen.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.xbts.common.core.enums.DateTypeEnum;
import com.xbts.common.core.enums.WorkshopTypeEnum;
import com.xbts.common.core.utils.DateUtils;
import com.xbts.common.core.web.domain.BaseHistogramResult;
import com.xbts.common.core.web.domain.BasePieChartResult;
import com.xbts.screen.domain.dto.WorkshopCompletionRateDto;
import com.xbts.screen.domain.workshop.dto.CommonQueryDTO;
import com.xbts.screen.domain.workshop.vo.*;
import com.xbts.screen.mapper.PackagingMapper;
import com.xbts.screen.service.IPackagingService;
import com.xbts.screen.service.IWorkshopCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 包装
 */
@Service
public class PackagingServerImpl implements IPackagingService {

    @Autowired
    private PackagingMapper packagingMapper;

    @Autowired
    private IWorkshopCommonService workshopCommonService;


    @Override
    public RealTimeAchievementRateVO realTimeAchievementRate() {
        CommonQueryDTO dto = new CommonQueryDTO();
        dto.setDeptNames(Arrays.asList(WorkshopTypeEnum.PACKAGING.getErpValue().split(",")));
        return workshopCommonService.realTimeAchievementRate(dto);
    }

    @Override
    public BaseHistogramResult tenDaysAchievementRate() {
        CommonQueryDTO dto = new CommonQueryDTO();
        dto.setDeptNames(Arrays.asList(WorkshopTypeEnum.PACKAGING.getErpValue().split(",")));
        return workshopCommonService.tenDaysAchievementRate(dto);
    }

    @Override
    public StatisticalRateGroupByTimeVO achievementRateGroupByTimeType() {
        CommonQueryDTO dto = new CommonQueryDTO();
        dto.setDeptNames(Arrays.asList(WorkshopTypeEnum.PACKAGING.getErpValue().split(",")));
        return workshopCommonService.achievementRateGroupByTimeType(dto);
    }
}